﻿var TempJsonParameter, TempQuery;

$(function () {
    window.progressDialog = new ProgressDialog();
    window.infoDialog = new InfoDialog();
    window.ajaxClass = new AjaxClass();

    $("#ButtonSave").button({ icons: { primary: "ui-icon-disk"} }).click(function () {
        var JsonSetting = $("#MainTable textarea[name='JsonSetting']").val();
        if (JsonSetting != "") {
            var CheckObj = null;
            try {
                CheckObj = JSON.parse(JsonSetting);
            } catch (e) {
                infoDialog.OpenDialog("配置参数格式错误：<br />" + e.type + "<br />请使用 Json 数据格式！", "Alert");
            }
            if (CheckObj != null) {
                var JsonSend = { "JsonString": JsonSetting };
                window.ajaxClass.AjaxSubmit($("#MainTable input[name='UrlAction']").val(), JsonSend, "", "window.location.href =  $(\"#MainTable input[name='UrlReferrer']\").val();", "", false, true);
            }
        } else {
            infoDialog.OpenDialog("配置参数必须填写！", "Alert");
        }
    });
    $("#ButtonBack").button({ icons: { primary: "ui-icon-arrowreturnthick-1-w"} }).click(function () {
        window.location.href = $("#MainTable input[name='UrlReferrer']").val();
    });
});